Skip to content

Conversation

@lenaploetzke
Copy link
Collaborator

@lenaploetzke lenaploetzke commented Feb 2, 2026

Describe your changes here:
Closes #2130
Very open for suggestions

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

All these boxes must be checked by the REVIEWERS before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually.
  • The code follows the t8code coding guidelines.
  • New source/header files are properly added to the CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation. Make sure to add a file documentation for each file!
  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue).

Tests

  • The code is covered in an existing or new test case using Google Test.
  • The code coverage of the project (reported in the CI) should not decrease. If coverage is decreased, make sure that this is reasonable and acceptable.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@lenaploetzke lenaploetzke linked an issue Feb 2, 2026 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 51.28205% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.89%. Comparing base (9f94c4e) to head (0e1c80b).

Files with missing lines Patch % Lines
src/t8_types/t8_vec.cxx 51.51% 16 Missing ⚠️
src/t8_types/t8_vec.hxx 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2139      +/-   ##
==========================================
- Coverage   77.95%   77.89%   -0.06%     
==========================================
  Files         113      112       -1     
  Lines       19089    19021      -68     
==========================================
- Hits        14881    14817      -64     
+ Misses       4208     4204       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/** Type alias for a 2D point.
*/
using t8_2D_vec = t8_vec<2>;
typedef std::array<double, 2> t8_2D_point;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you you think, do we still need the differentiation between vectors and points or is a general dimensional type sufficient?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep the vector name, since a vector is not only a vector in a geometric sense, but also a one-dimensional tensor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i also think that one dimensional object is enough. And yes i agree that we can just name it t8_vec and not t8_dimensional. I just defined both because we have so many usages of t8_3D_point in t8code...

Comment on lines 114 to 115
template <typename T>
concept T8ContainerdoubleType = requires (T t) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename T>
concept T8ContainerdoubleType = requires (T t) {
template <typename TType>
concept T8ContainerDoubleType = requires (TType type) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to T8ContainerType and deleted the other one

*/
template <typename T, std::size_t Expected = static_cast<std::size_t> (-1)>
concept T8VecType = requires { typename std::remove_cvref_t<T>::tag; } && requires {
concept T8ContainerType = requires (TType t) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use cpp20 now, we can also use ranges for this :)
This is more open and checks everything automatically

template <typename TType>
concept T8Range =
  std::ranges::input_range<TType> &&
  std::convertible_to<std::ranges::range_value_t<TType>, double>;

static inline void
t8_cross_3D (const TVecX &vec_x, const TVecY &vec_y, TVecCross &cross)
{
T8_ASSERT ((vec_x.size () == 3) && (vec_y.size () == 3));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all containers have a function named size (). Ranges is the container agnostic way.
cross needs to be big enough for the output values.

Suggested change
T8_ASSERT ((vec_x.size () == 3) && (vec_y.size () == 3));
T8_ASSERT ((std::ranges::distance(vec_x) >= 3) && (std::ranges::distance(vec_y) >= 3) && (std::ranges::distance(cross) >= 3));

template <T8ContainerType TVecX, T8ContainerType TVecY, T8ContainerType TVecDiff>
constexpr void
t8_diff (const TVecX &vec_x, const TVecY &vec_y, TVecDiff &diff)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size check is missing

static inline void
t8_normal_of_tri (const TVecP1 &p1, const TVecP2 &p2, const TVecP3 &p3, TVecNormal &normal)
{
T8_ASSERT ((p1.size () == 3) && (p2.size () == 3) && (p3.size () == 3));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
T8_ASSERT ((p1.size () == 3) && (p2.size () == 3) && (p3.size () == 3));
T8_ASSERT ((std::ranges::distance(p1) >= 3) && (std::ranges::distance(p2) >= 3) && (std::ranges::distance(p3) >= 3));

static inline void
t8_orthogonal_tripod (const TVecV1 &v1, TVecV2 &v2, TVecV3 &v3)
{
T8_ASSERT (v1.size () == 3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 and v3 still need to be big enough to hold the output values.

Suggested change
T8_ASSERT (v1.size () == 3);
T8_ASSERT ((std::ranges::distance(v1) >= 3) && (std::ranges::distance(v2) >= 3) && (std::ranges::distance(v3) >= 3));

static inline double
t8_cross_2D (const TVecX &vec_x, const TVecY &vec_y)
{
T8_ASSERT ((vec_x.size () == 2) && (vec_y.size () == 2));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all containers have a function named size (). Ranges is the container agnostic way.
Also it would be nice to check if the containers have at least the right size. In t8code we also sometimes use 3D containers to store 2D values and if this assertion is too limited, we cannot use this function.

Suggested change
T8_ASSERT ((vec_x.size () == 2) && (vec_y.size () == 2));
T8_ASSERT ((std::ranges::distance(vec_x) >= 2) && (std::ranges::distance(vec_y) >= 2));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove strong types from t8_3D_vec and t8_3D_point

2 participants